package think_in_java;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;

public class AddAddByteCode {

    public static void main(String[] args) {

//        int i = 0;
//        i = i++;
//        i = ++i;
//        i++;
//        System.out.println(i);

        List<Long> l1 = Collections.emptyList();
        System.out.println(generateString(l1));
        List<Long> l2 = Arrays.asList(1L, 2L);

        System.out.println(l2);


        List<String> s = new ArrayList<>();
        s = s.subList(0, 0);
        s.add("1");
        s.add("1-2");
        s.add("1-1-1");
        s.sort(Comparator.comparing(String::length));
        System.out.println(s);

        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        Date date = timestamp;
        System.out.println(date);

        List<Integer> is = new ArrayList<>();
        is.add(1);
        is.add(2);
        String s1 = JSON.toJSONString(is);
        List<Integer> integers = JSONArray.parseArray(s1, Integer.class);
        System.out.println(s1);
        System.out.println(integers);

        String url = "http://video.menkor.com/310d288c0a294038981e7a9dccf93dcc/1f82ff9ccddb467eaba09c5b635d12d9-32f96b5be6642b76e53ec7180806ca29-sd.mp4";
        String url2 = "https" + url.substring(url.indexOf(':'));
        System.out.println(url2);

        List<String> e = new ArrayList<>();
        e.add(0, "1");
        e.add(e.size(), "246");
        System.out.println(e);

        LinkedList<Long> ls = new LinkedList<>();
        ls.add(1L);
        ls.add(2L);
        String sls = JSON.toJSONString(ls);
        System.out.println(sls);
    }


    private static String generateString(List<Long> ids) {
        return ids.stream().map(Object::toString).collect(Collectors.joining(",", "(", ")"));
    }

}
